export enum EventName {
  FetchRuleSuccess, // 规则获取成功
  FetchRuleFail, // 规则获取失败
  RuleCompileSuccess, // 规则编译成功
  RuleCompileFail, // 规则编译失败
  ValidateSuccess, // 规则校验成功
  ValidateFail, // 规则校验失败
  DataCenterUpdateTime, // 任务中心更新时间上报
  ServerTiming, // 请求耗时上报
  CacheTimeout, // 缓存超时释放
  StageTiming, // 各阶段耗时
  CompileRuleTiming, // 各阶段耗时
}

export enum ErrorName {
  JsError,
  PresetError,
  CustomPresetError,
}

export type ReportContent<T> = { categories?: Record<string, T>; metrics?: Record<string, number> };
export interface CustomReporter {
  sendLog: (eventName: string, extra: ReportContent<string>) => void;
  reportError: (errorName: string, extra: Record<string, string>) => void;
}

export interface ApiTrackReporter {
  sendLog: (eventName: EventName | string, extra?: ReportContent<string>) => void;
  reportError: (errorName: ErrorName, extra: Record<string, string>) => void;
  setBaseInfo: (baseInfo: Record<string, unknown>) => void;
}
